﻿using System;

namespace UtilZ.Dotnet.Extensions.Log
{
    /// <summary>
    /// 
    /// </summary>
    public class ExtensionLogerUse
    {
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static string GetDemo()
        {
            return @"public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
            .ConfigureAppConfiguration((hostingContext, config) =>
            {
                config.AddJsonFile(""hosting.json"", true, true);//读取监听端口配置
            })
            .ConfigureLogging((hostingContext, logging) =>
            {
            logging.ClearProviders();
            logging.AddProvider(new FileLoggerProvider());
        })
            .ConfigureWebHostDefaults(webBuilder =>
            {
            webBuilder.UseStartup<Startup>();
        });";
        }
    }
}
